import { createApp } from 'vue'
import { createPinia } from "pinia";

import './style.css'
import App from './App.vue'
import router from "./router";
import Vant from 'vant';
import 'vant/lib/index.css';
import axios from 'axios'
import elementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import { ElMessage } from 'element-plus'

// 请求拦截器，在请求头中添加toke
axios.interceptors.request.use(item => {
    let shortToken = sessionStorage.shorttermToken
    let longToken = sessionStorage.longtermToken
    if (shortToken && longToken) {
        item.headers.shortToken = shortToken
        item.headers.longToken = longToken
    }
    return item
})
// 设置请求的根路径
axios.defaults.baseURL = 'http://127.0.0.1:3789/'



const app = createApp(App);
const pinia = createPinia();

app.use(Vant)
app.use(router)
app.use(pinia);
app.use(elementPlus)
export default axios
app.mount("#app");
